var etaCardInfo = {//会员体系兑换商品管理
    id: "etaCardInfoTable",	//表格id
    seItem: null,		//选中的条目
    table: null,
    layerIndex: -1
};

etaCardInfo.initColumn = function () {// 初始化表格的列
    return [
        {field: 'selectItem', radio: true},
        {title: '', field: 'id', visible: false, align: 'center', valign: 'middle', width: '50px'},
        {title: '卡号', field: 'etaCard', align: 'center', valign: 'middle', sortable: true},
        {title: '项目名称', field: 'payServiceName', align: 'center', valign: 'middle', sortable: true},
        {title: '状态', field: 'status', align: 'center', valign: 'middle', sortable: true}
    ];
};

etaCardInfo.check = function () { // 检查是否选中
    var selected = $('#' + this.id).bootstrapTable('getSelections');
    if (selected.length == 0) {
        Feng.info("请先选中表格中的某一记录！");
        return false;
    } else {
        etaCardInfo.seItem = selected[0];
        return true;
    }
};

etaCardInfo.formParams = function () {//查询表单提交参数对象 @returns {{}}
    var queryData = {};
    queryData['etaCard'] = $("#etaCard").val();
    queryData['payServiceName'] = $("#payServiceName").val();
    queryData['status'] = $("#status").val();
    return queryData;
};

etaCardInfo.resetSearch = function () {
    $("#etaCard").val("");
    $("#payServiceName").val("");
    $("#status").val("");
    etaCardInfo.search();
};

etaCardInfo.search = function () {//查询列表
    etaCardInfo.table.refresh({query: etaCardInfo.formParams()});
};

$(function () {
    var defaultColunms = etaCardInfo.initColumn();
    var table = new BSTable(etaCardInfo.id, "/etaCardInfo/list", defaultColunms);
    table.setPaginationType("server");
    table.setQueryParams(etaCardInfo.formParams());
    etaCardInfo.table = table.init();
    etaCardInfo.table = table;
});